package org.hot100_1;

import java.util.ArrayList;
import java.util.HashSet;

public class leetcode91 {
    public int singleNumber(int[] nums) {

        HashSet<Integer> set = new HashSet<>();

        for (int num:nums) {
            if (set.contains(num)){
                set.remove(num);
            }else {
                set.add(num);
            }
        }

        return new ArrayList<>(set).get(0);
    }
}
